//继承
// 继承主要实现代码逻辑的复用，或说是增加属性和方法的复用
//继承也会导致代码层次过深，类和类之间出现耦合，如果修改父类，子类也会改变
  export {}
//父类
class Animal {
  name: string;
  age: number;
  constructor(name: string, age: number) {
    this.name = name;
    this.age = age;
  };
  eat(): void{
    console.log('父类中的eat方法',this.name+'---'+this.age)
  }
};
//子类
class Dog extends Animal{
  constructor(name: string, age: number) {
    super(name,age);
  }
};
 //子类的实例
let dog = new Dog('小黑', 17);
dog.eat();